<template>
	<view>
		<!-- <view class="css-logo">
			<image src="../../static/logo.jpg" mode="aspectFit" style="width: 100%;height: 100%;"></image>
		</view> -->
		<view class="css-content">
			<view class="css-title">
				授权网络营销代理商
			</view>
			<view class="css-subTitle">
				黑龙江兴荣科技发展有限公司
			</view>
			<view class="css-num">
				NO.e231105
			</view>
		</view>

		<!-- <view class="css-use">
			<view class="css-usecode" v-if="inviteCode">
				邀请码
				<br />
				<span>{{ inviteCode }}</span>
			</view>
		</view> -->
		<view class="css-tab">
			<view class="css-cell">
				<view class="">
					业务员
				</view>
				<view class="css-cell-right">
					{{ username }}
				</view>
			</view>
			<view class="css-cell">
				<view class="">
					邀请码
				</view>
				<view class="css-cell-right">
					{{ inviteCode }}
				</view>
			</view>
			<view class="css-cell none-line">
				<view class="">
					联系方式
				</view>
				<view class="css-cell-right">
					{{ phonenumber }}
				</view>
			</view>
		</view>

		<view class="css-tab">
			<view class="css-cell" @click="handleGoQrCode()">
				<view class="">
					我的二维码
				</view>
				<image src="../../static/arrow.png" mode="aspectFit" style="width: 20px;height: 20px;"></image>
			</view>
			<view class="css-cell none-line" @click="handleGoOrder">
				<view class="">
					订单查询
				</view>
				<image src="../../static/arrow.png" mode="aspectFit" style="width: 20px;height: 20px;"></image>
			</view>

		</view>

		<view class="css-loginOut" @click="handleLoginOut">
			退出登录
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				qrcode: "",
				phonenumber: "",
				username: "",
				inviteCode: ""
			}
		},
		onShow() {
			var token = uni.getStorageSync('token');
			if (token) {
				this.phonenumber = uni.getStorageSync('phonenumber');
				this.username = uni.getStorageSync('username');
				this.inviteCode = uni.getStorageSync('inviteCode');

				const baseURL = getApp().globalData.baseURL; //  pro_gdapp_h5

				var header = {};
				header["Authorization"] = token;

				uni.request({
					url: baseURL + "/liantong/getQrUrl",
					header: header,
					success: (res) => {
						console.log(res.data);
						if (res.data.code == 200 || res.data.code == 0) {
							this.qrcode = res.data.data;
						}
					}
				});
			} else {
				uni.reLaunch({
					url: "/pages/login/login"
				});
			}
		},

		methods: {
			handleLoginOut() {
				uni.showModal({
					title: "提示",
					content: "正在登出当前账号！",
					confirmText: "登出",
					success: (res) => {
						if (res.confirm) {
							uni.removeStorageSync('token');
							uni.reLaunch({
								url: '/pages/login/login'
							})
						}
					}
				});
			},
			handleGoQrCode() {
				uni.navigateTo({
					url: '/pages/qrcode/qrcode'
				})
			},
			handleGoOrder() {
				uni.navigateTo({
					url: '/pages/list-order/list-order'
				})
			},
			handleCall() {
				uni.makePhoneCall({
					phoneNumber: this.phonenumber
				})
			}

		}
	}
</script>

<style scoped lang="scss">
	.css-loginOut {
		position: relative;
		height: 50px;
		line-height: 50px;
		width: 200px;
		margin: auto;
		margin-top: 40px;
		background: #FD90A5;
		text-align: center;
		color: #fff;
		border-radius: 8px;
	}

	.css-logo {
		width: 300px;
		height: 160px;
		margin: auto;
	}

	.css-tab {
		width: 90vw;
		margin-left: 5vw;
		margin-top: 5vw;
		padding: 10px 15px;
		border-radius: 8px;
		background: #dde1e7;
		box-shadow: -3px -3px 7px #ffffff73,
			2px 2px 5px rgba(94, 104, 121, 0.288);
	}

	.css-cell {
		height: 50px;
		border-bottom-color: #fff;
		border-bottom-width: 1px;
		border-bottom-style: solid;
		color: #595959;
		font-weight: 600;
		text-align: center;
		line-height: 50px;
		display: flex;
		justify-content: space-between;
		align-items: center;

		.css-cell-right {
			display: flex;
			align-items: center;
			// font-size: 12px;
			color: #595959;
		}
	}

	.none-line {
		border: none;
	}

	.css-content {
		background-color: #D72743;
		width: 90vw;
		margin-left: 5vw;
		padding: 30px 10px;
		margin-top: 5vw;
		border-radius: 8px;

		.css-title {
			text-align: center;
			font-size: 26px;
			font-weight: bold;
			color: #fff;
		}

		.css-subTitle {
			text-align: center;
			font-size: 15px;
			font-weight: bold;
			color: #fff;
			margin-top: 10px;
		}

		.css-num {
			text-align: center;
			font-size: 20px;
			color: #fff;
			margin-top: 10px;
			margin-bottom: 10px;
		}
	}

	.css-use {
		background-color: #F87085;
		width: 90vw;
		margin-left: 5vw;
		padding: 30px 10px;
		margin-top: 5vw;
		border-radius: 8px;

		.css-use-name {
			text-align: center;
			color: #fff;
		}

		.css-use-phone {
			text-align: center;
			color: #ddd;
			padding: 10px 0;
		}

		.css-usecode {
			text-align: center;
			color: #fff;
			padding-bottom: 10px;
		}

		.css-usecode span {
			font-size: 24px;
			font-weight: bold;
			line-height: 30px;
		}

		.css-qrcode {
			width: 50vw;
			height: 50vw;
			margin: auto;
		}
	}
</style>